package cn.iocoder.yudao.module.student.dal.mysql.invite;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.student.dal.dataobject.invite.InviteDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.student.controller.app.invite.vo.*;

/**
 * 面试邀约 Mapper
 *
 * @author 周枫皓
 */
@Mapper
public interface InviteMapper extends BaseMapperX<InviteDO> {

    default PageResult<InviteDO> selectPage(AppInvitePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InviteDO>()
                .eq(InviteDO::getStudentId, reqVO.getStudentId())
                .likeIfPresent(InviteDO::getStudentName, reqVO.getStudentName())
                .eqIfPresent(InviteDO::getPhoneNumber, reqVO.getPhoneNumber())
                .betweenIfPresent(InviteDO::getInviteDate, reqVO.getBeginInviteDate(), reqVO.getEndInviteDate())
                .likeIfPresent(InviteDO::getCompanyName, reqVO.getCompanyName())
                .likeIfPresent(InviteDO::getPublisherName, reqVO.getPublisherName())
                .eqIfPresent(InviteDO::getStatus, reqVO.getStatus())
                .likeIfPresent(InviteDO::getCity, reqVO.getCity())
                .likeIfPresent(InviteDO::getJobName, reqVO.getJobName())
                .orderByDesc(InviteDO::getId));
    }
    default PageResult<InviteDO> selectPage(AppInvitePageReqVO reqVO,List<String> status) {
        return selectPage(reqVO, new LambdaQueryWrapperX<InviteDO>()
                .inIfPresent(InviteDO::getStatus,status)
                .likeIfPresent(InviteDO::getStudentName, reqVO.getStudentName())
                .eqIfPresent(InviteDO::getPhoneNumber, reqVO.getPhoneNumber())
                .eqIfPresent(InviteDO::getStudentId, reqVO.getStudentId())
                .eqIfPresent(InviteDO::getJobId, reqVO.getJobId())
                .eqIfPresent(InviteDO::getCompanyId, reqVO.getCompanyName())
                .betweenIfPresent(InviteDO::getInviteDate, reqVO.getBeginInviteDate(), reqVO.getEndInviteDate())
                .likeIfPresent(InviteDO::getCompanyName, reqVO.getCompanyName())
                .likeIfPresent(InviteDO::getPublisherName, reqVO.getPublisherName())
                .likeIfPresent(InviteDO::getJobName, reqVO.getJobName())
                .orderByDesc(InviteDO::getId));
    }

    default List<InviteDO> selectList(AppInviteExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<InviteDO>()
                .likeIfPresent(InviteDO::getStudentName, reqVO.getStudentName())
                .eqIfPresent(InviteDO::getPhoneNumber, reqVO.getPhoneNumber())
                .betweenIfPresent(InviteDO::getInviteDate, reqVO.getBeginInviteDate(), reqVO.getEndInviteDate())
                .likeIfPresent(InviteDO::getCompanyName, reqVO.getCompanyName())
                .likeIfPresent(InviteDO::getPublisherName, reqVO.getPublisherName())
                .eqIfPresent(InviteDO::getStatus, reqVO.getStatus())
                .likeIfPresent(InviteDO::getJobName, reqVO.getJobName())
                .orderByDesc(InviteDO::getId));
    }

}
